package com.example.spring_java_oj.model;

import lombok.Data;

@Data
public class CompileResponse {
    //错误类别。0为ok，1为编译错误，2为运行错误
    public int error;
    //错误原因
    public String reason;
    //运行结输出
    public String stdout;

    public String mergeCode(String requestCode, String testCode) {
        int pos = requestCode.lastIndexOf("}");
        if (pos == -1){
            return null;
        }
        String subStr = requestCode.substring(0, pos);
        return subStr + testCode +"\n}";
    }
}
